- commit = @repository.commit(tag.dereferenced_target) if tag.dereferenced_target.present?
- release = @releases.find { |release| release.tag == tag.name }
- commit_status = @tag_pipeline_statuses[tag.name] if @tag_pipeline_statuses
- pipeline = commit_status&.subject

%li.gl-justify-between{ class: "@md/panel:!gl-flex !gl-items-start !gl-px-5", data: { testid: 'tag-row' } }
  .gl-flex-auto
    %h2.gl-inline.gl-m-0.gl-font-bold.gl-text-size-h2
      = sprite_icon('tag', css_class: "gl-fill-icon-subtle")
      = link_to tag.name, project_tag_path(@project, tag.name)
      = clipboard_button(text: tag.name, title: _("Copy tag name"))

    - if protected_tag?(@project, tag)
      = gl_badge_tag s_('TagsPage|protected'), variant: :neutral, class: 'gl-ml-2'

    - if commit
      .gl-truncate
        = render 'projects/branches/commit', commit: commit, project: @project
    - else
      %p
        = s_("TagsPage|Can't find HEAD commit for this tag")

    - if release
      = render 'release_link', project: @project, release: release

    - if tag.message.present?
      %pre.wrap.gl-mt-3.gl-max-w-80
        = strip_signature(tag.message)

  .gl-grow-0.gl-shrink-0.gl-flex.gl-flex-row.gl-items-center.gl-gap-3.gl-mt-2
    - if tag.has_signature?
      = render partial: 'projects/commit/signature', object: tag_view_signature(tag)

    - if commit_status

      = render 'ci/status/icon', status: commit_status, option_css_classes: 'gl-inline-flex gl-align-middle'
    - elsif @tag_pipeline_statuses && @tag_pipeline_statuses.any?
      .gl-inline-flex.gl-align-middle
        %svg.s24

    - if can?(current_user, :admin_tag, @project)
      = render 'edit_release_button', tag: tag, project: @project, release: release

    = render 'projects/buttons/download', project: @project, ref: tag.name, ref_type: :tags, pipeline: pipeline

    - if can?(current_user, :admin_tag, @project)
      = render 'projects/buttons/remove_tag', project: @project, tag: tag
